from django.conf.urls.defaults import *
from django.view.generic.list_detail import object_list
from pennypress.base.models import PennyPressBase
from pennypress.apps.categories.models import Section
from pennypress.apps.categories.sectionviews import section_list, section_detail, \
    section_archive_day, section_archive_month, section_archive_year, section_latest

info_dict = {
    'queryset':PennyPressBase.active_abjects.all(),
    'date_field': 'publish_date',
    'paginate_by': 25,
}

urlpatterns = patterns('',
    url(r'^(?P<section>[\w_/\-]+)(?P<year>\d{4})/(?P<month>[A-Za-z]{3})/(?P<day>\d{1,2})/$', section_archive_day, info_dict, name='section_archive_day'),
    url(r'^(?P<section>[\w_/\-]+)(?P<year>\d{4})/(?P<month>[A-Za-z]{3})/$', section_archive_month, info_dict, name='section_archive_month'),
    url(r'^(?P<section>[\w_/\-]+)(?P<year>\d{4})/$', section_archive_year, info_dict, name='section_archive_year'),
    url(r'^(?P<section>[\w_/\-]+/)latest/$', section_latest, {'queryset' : Story.active_objects.all(),}, name='section_latest'),
    url(r'^(?P<section>[\w_/\-]+/)$', section_detail, info_dict, name='section_detail'),
    url(r'^sections/$', object_list, {'queryset':Section.objects.all(),}, name='section_list'),
)
